<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/reset.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/weui.min.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/index.css">
    <script src="<%=path%>/static/js/jquery-3.2.1.min.js"></script>
    <script src="<%=path%>/static/layer/layer.js"></script>
    <title>嘉华金融</title>
</head>
<body>
 <div>
    <div class="header">
        <div><div class="back"></div></div>
        <div>银行卡</div>
        <div><!-- <div class="user-img"></div> --></div>
    </div>
    <div class="main">
        <div class="bank-card-wrap">
         <c:forEach items="${bCards}" var="item" varStatus="vs">
            <div class="bank-card">
                <div>
                    <div class="left">${item.source}</div>
                    <div class="right gar"><input type="hidden" value="${item.cardId}"></div>
                </div>
                <div></div>
                <div>
                    <div>
                        <div class="left">**** **** ****</div>
                        <div class="left">&nbsp;${item.cardIdCopy}</div>
                    </div>
                </div>
            </div>
           </c:forEach> 
        </div>
        <a class="add-card border-top border-bottom" href="<%=path%>/member/addCard.html">
            <div>
                <div class="add-img left"></div>
                <div class="left">添加银行卡</div>
            </div>
        </a>
    </div>
</div>
<script type="text/javascript">
    //删除银行卡
    var path="<%=path%>";
    $(".gar").on('click',function() {
    	var cardId=$(this).find("input").val();
    	 layer.confirm('确定删除该银行卡吗?', {icon: 3, title:'提示'}, function(index){
             $.ajax({
                url:path+"/member/deleteCard.html",
                data:{
                    cardId:cardId, 
                 },
                type : "POST",
                datatype : "json",
                async: false,
                success : function(datas) {
                   flag=true;
                   var json =JSON.parse(datas);
                   layer.msg(json.msg, {time: 2000},function(){
                          if(json.code==200){
                            //$(this).parent().parent().remove();
                                window.location=path+"/member/bankCard.html";
                          }
                      });
                  }
             });
         });  	 
    });
    
    $('.back').on('click', function () {
  	     window.location=path+"/member/memberCenter.html";
 	 });
</script>
</body>
</html>